import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    tags: [
      { value: '首页', path: '/home', selected: true, hover: false },
      { value: '产品列表', path: '/home', selected: false, hover: false }
    ],
    collapse: false
  },
  mutations: {
    addTags(state, item) {
      state.tags.push(item)
      state.tags.forEach((itm) => {
        if (itm !== item) {
          itm.selected = false
        }
      })
    },
    deleteTags(state, index) {
      state.splice(index, 1)
    },
    collapseChange(state, value) {
      state.collapse = value
    }
  },
  getters: {},
  actions: {}
})

